<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="style.css" />
    <style>
      body {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
      }
      svg {
        border: 2px solid black;
      }
    </style>
  </head>

  <body>
    <svg width="774" height="181" viewBox="0 0 774 181" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path id="movePath" d="M2 180C55.2946 82.0084 202.047 -80.7778 362.698 52.0109C523.349 184.8 702.504 87.3415 772 22.0139" stroke="black" stroke-width="4" />
      <circle r="30" fill="red" id="myCircle"></circle>
      <!-- 路径绑定：path||mpath 通过href绑定路径 -->
      <!-- 也可以直接给animateMotion添加path属性 -->
      <animateMotion href="#myCircle" dur="2s" repeatCount="indefinite">
        <mpath href="#movePath" />
      </animateMotion>
    </svg>
  </body>
</html>
